﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.DynamicData.ModelProviders;

namespace Mpu.NHibernateDataModelProvider.ColumnProviders
{
    public class NHibernatePrimaryKeyColumnProvider : NHibernateColumnProviderBase
    {
        public NHibernatePrimaryKeyColumnProvider(TableProvider table, NHibernate.Mapping.Column column)
            : base(table)
        {
            this.Name = column.Name;
            this.ColumnType = column.Value.Type.ReturnedClass;
            this.IsPrimaryKey = true;

            this.IsGenerated = ((NHibernate.Mapping.SimpleValue)column.Value).IdentifierGeneratorStrategy == "native";
        }
    }
}
